﻿#region Copyrights Notice
//©2009 Microsoft Corporation.  All rights reserved.
//This portal design is based on the design and some code from DropThings.com which is also licensed under an MS-PL license.
#endregion

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Microsoft.InformationSecurity.CISF.Portal.Business
{
    
    public class RealWeblet
    {
        //Private properties
        private SingleWeblet m_ctrlWebletControl;

        private int m_nCol;
        private int m_nRow;
        
        private Int32 m_nRealInstanceID;
        private Int32 m_nControlID;
        
        private Int32 m_nUserId;
        
        private bool m_nIsExpanded;
        private string m_strCaption;
        private string m_xmlStorage;
        private int m_nVersion;

        public RealWeblet(SingleWeblet w)
        {
            m_ctrlWebletControl = w;
            m_nControlID = w.WidgetId;
            m_strCaption = w.Name;
            m_xmlStorage = w.DefaultState;
            m_nVersion = w.VersionNo;
        }
        
        public RealWeblet()
        {
            m_ctrlWebletControl = new SingleWeblet(); 
        }


        public int TableColPos
        {
            get { return m_nCol; }
            set { m_nCol = value; }
        }
        public int TableRowPos
        {
            get { return m_nRow; }
            set { m_nRow = value; }
        }



    
        public Int32 WidgetInstanceId
        {
            get { return m_nRealInstanceID; }
            set { m_nRealInstanceID = value;  }
        }
        public Int32 WidgetId
        {
            get { return m_nControlID; }
            set { m_nControlID = value; }
        }
        public Int32 UserId
        {
            get { return m_nUserId; }
            set { m_nUserId = value; }
        }
        

        public bool IsExpanded
        {
            get { return m_nIsExpanded; }
            set { m_nIsExpanded = value; }
        }

        public int Expanded
        {
            get {
                if (m_nIsExpanded)
                    return 1;
                else
                    return 0;
            }
            
        }
        public void SetExpanded(int Expanded)
            {
                if (Expanded == 1)
                    m_nIsExpanded = true;
                else
                    m_nIsExpanded = false;
            
        }

        public string Caption
        {
            get { return m_strCaption; }
            set { m_strCaption = value; }
        }

        public string State
        {
            get { return m_xmlStorage; }
            set { m_xmlStorage = value; }
        }
        public int VersionNo
        {
            get { return m_nVersion; }
            set { m_nVersion = value; }
        }
        public SingleWeblet SingleWeblet
        {
            get { return m_ctrlWebletControl; }
            set { m_ctrlWebletControl = value; }
        }
        //
    
    }


}
